{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d0d40f58",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello\n"
     ]
    }
   ],
   "source": [
    "print (\"hello\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "540d37af",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#给变量赋值\n",
    "is_ml_geek = True\n",
    "#check \n",
    "is_ml_geek"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "862dcf35",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "excellent\n"
     ]
    }
   ],
   "source": [
    "if is_ml_geek is True:\n",
    "    print (\"excellent\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d1ebe449",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "int"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#整数型\n",
    "type(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "863bcc43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "float"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#浮点数\n",
    "type(0.34)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "8508a74e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "complex"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#复数\n",
    "type(1+3j)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "e1a03b53",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "bool"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#布尔值\n",
    "type(True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b4eb6367",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#字符串\n",
    "type(\"123\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b2eb4c3b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(\"wo\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "1c3f99d9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(10, 2, 3.4, True, 'ac')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "tuple"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_1= (10, 2, 3.4, True, \"ac\")  #将元祖赋值给变量X_1\n",
    "print (X_1)\n",
    "type(X_1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "56a421a3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[10, 2, 3.4, True, 'ac']\n"
     ]
    }
   ],
   "source": [
    "X_2= [10, 2, 3.4, True, \"ac\"]  #将列表赋值给变量X_2\n",
    "print(X_2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "91151b6b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "list"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(X_2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "e2b7eacd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'be', 1, 2, 5.5}\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "set"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_set= {1, 2, 5.5, \"be\"}   #将集合赋值给变量x_set\n",
    "print(x_set)\n",
    "type(x_set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "aec9519e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1: 10, 2: 3, 3: 'abc'}\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "dict"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_dic= {1:10, 2:3, 3:\"abc\" }   #将字典赋值变量x_dic \n",
    "print(x_dic)\n",
    "type(x_dic)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "5c4b7c87",
   "metadata": {},
   "outputs": [],
   "source": [
    "########3.4########"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ba8a5cbd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "210.11"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10+200.11   #加法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "a8dde930",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-43.4"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "20-63.4  #减法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "f1aace21",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "20  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "49fa9bf3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.07575757575757576"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "5/66  #除法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "680ac336",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "4//7  #整除"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "f3824330",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "9//7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "9ccd731d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.3333333333333335"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "7/3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "83173b52",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "7%9  #余数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "5ab68e43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "49"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "7**2   #幂运算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "5d6de8c3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10>20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "f8102cef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10>20.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "31da78b8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10==10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "666ed88d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10!=10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "d4e04db1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_dic[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "427c3cd7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'abc'"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_dic[3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "d94d099d",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "'set' object is not subscriptable",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[0;32mIn [46]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mx_set\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\n",
      "\u001b[0;31mTypeError\u001b[0m: 'set' object is not subscriptable"
     ]
    }
   ],
   "source": [
    "x_set[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "ce04eca7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_2[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "e3222982",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3.4, True, 'ac']"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_2[0]=1\n",
    "X_2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "a43fc65e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "5 in X_2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "3f8b4f22",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "True or False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "4e6d504e",
   "metadata": {},
   "outputs": [],
   "source": [
    "###3.5###"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "c13c875c",
   "metadata": {},
   "outputs": [],
   "source": [
    "b= True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "5a57bacc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Real\n"
     ]
    }
   ],
   "source": [
    "if b:\n",
    "    print(\"Real\")\n",
    "else:\n",
    "    print(\"notReal\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "38e49dea",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 10\n",
      "2 3\n",
      "3 abc\n"
     ]
    }
   ],
   "source": [
    "#循环语句\n",
    "\n",
    "for k in [1,2,3]:\n",
    "    print(k,x_dic[k])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "07eb1a74",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n",
      "4\n",
      "5\n",
      "6\n",
      "7\n"
     ]
    }
   ],
   "source": [
    "nb=[0,1,2,3,4,5,6,7]\n",
    "i= 3\n",
    "\n",
    "while i <len(nb):\n",
    "    print (nb[i])\n",
    "    i +=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "432bfd2a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
